from django.db import models

# Create your models here.


class Question(models.Model):
    question_text = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')

    def __str__(self) -> str:
        return self.question_text

class Choice(models.Model):
    question = models.ForeignKey(Question,on_delete=models.CASCADE)
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)

    def __str__(self) -> str:
        return self.choice_text

class User(models.Model):
    class Gender(models.IntegerChoices):
        NA = 1, "不适用"
        MALE = 2, "男"
        FEMALE = 3, "女"
        NON_BINARY = 4, "非二元"
    authingid = models.CharField(max_length=100,unique=True)
    gender = models.PositiveSmallIntegerField(
        choices=Gender.choices,
        default=Gender.NA
    )
    age = models.PositiveSmallIntegerField(default=1)
    motto = models.CharField(max_length=200)
    nickname = models.CharField(max_length=16,default="新用户")